package com.homedo.async.mysql.support.mapper.delete;

import com.homedo.async.mysql.support.mapper.MapperI;
import io.vertx.sqlclient.SqlConnection;
import org.reactivestreams.Publisher;
import reactor.core.publisher.Mono;

/**
 * @author jgshun
 * @date 2020/3/17 10:30 AM
 */
public interface DeleteMapperI<T, ID> extends MapperI<T, ID> {

    Mono<Long> deleteById(ID id);

    Mono<Long> deleteById(Publisher<ID> id);

    Mono<Long> deleteByIds(Iterable<ID> ids);

    Mono<Long> deleteByIds(Publisher<ID> idStream);

    Mono<Long> deleteByRecordSelective(T entity);

    Mono<Long> deleteByRecordsSelective(Iterable<? extends T> entities);

    Mono<Long> deleteByRecordsSelective(Publisher<? extends T> entityStream);

    Mono<Long> deleteByRecord(T entity);

    Mono<Long> deleteByRecords(Iterable<? extends T> entities);

    Mono<Long> deleteByRecords(Publisher<? extends T> entityStream);

    Mono<Long> deleteAll();


    //=== 传入 Connection 是为了统一获得事务能力

    Mono<Long> deleteById(ID id, SqlConnection connection);

    Mono<Long> deleteById(Publisher<ID> id, SqlConnection connection);

    Mono<Long> deleteByIds(Iterable<ID> ids, SqlConnection connection);

    Mono<Long> deleteByIds(Publisher<ID> idStream, SqlConnection connection);

    Mono<Long> deleteByRecordSelective(T entity, SqlConnection connection);

    Mono<Long> deleteByRecordsSelective(Iterable<? extends T> entities, SqlConnection connection);

    Mono<Long> deleteByRecordsSelective(Publisher<? extends T> entityStream, SqlConnection connection);

    Mono<Long> deleteByRecord(T entity, SqlConnection connection);

    Mono<Long> deleteByRecords(Iterable<? extends T> entities, SqlConnection connection);

    Mono<Long> deleteByRecords(Publisher<? extends T> entityStream, SqlConnection connection);

    Mono<Long> deleteAll(SqlConnection connection);

}
